﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;

/// <summary>
/// Summary description for Users
/// </summary>
public class Users
{
    public int User_id { get; set; }
    public int Permission_id { get; set; }
    public string Permission { get; set; }
    public string Username { get; set; }
    public string Password { get; set; }
    public string Address { get; set; }
    public string Email { get; set; }
    public string Phone { get; set; }
    public DateTime Birthday { get; set; }
    public string Province { get; set; }
    public string District { get; set; }
    public bool Status { get; set; }
    public DateTime DateStart { get; set; }
    public DateTime DateUpdate { get; set; }

	public Users()
	{
	    this.User_id = 0;
	    this.Permission_id = 0;
	    this.Permission = "";
	    this.Username = "";
	    this.Password = "";
	    this.Address = "";
	    this.Email = "";
	    this.Phone = "";
	    this.Birthday = DateTime.Now;
	    this.Province = "";
	    this.District = "";
	    this.Status = true;
	    this.DateStart = DateTime.Now;
	    this.DateUpdate = DateTime.Now;
	}
    public Users(DataRow dr)
    {
        this.User_id = Convert.ToInt32(dr[0].ToString());
        this.Permission_id = Convert.ToInt32(dr[1].ToString());
        this.Username = dr[2].ToString();
        this.Password = dr[3].ToString();
        this.Address = dr[4].ToString();
        this.Email = dr[5].ToString();
        this.Phone = dr[6].ToString();
        this.Birthday = DateTime.Parse(dr[7].ToString());
        this.Province = dr[8].ToString();
        this.District = dr[9].ToString();
        this.Status = Convert.ToBoolean(dr[10].ToString());
        this.DateStart = DateTime.Parse(dr[11].ToString());
        if (dr[12].ToString() != null && dr[12].ToString()!="")
            this.DateUpdate = DateTime.Parse(dr[12].ToString());
    }
}